﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebClient.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function onSelectedIndexChanged_DistrictHeader() {
            var city = document.getElementsByName("ListCityHeader").item(0);
            var district = document.getElementsByName("ListDistrictHeader").item(0);
            // if foodtype is have selected value
            var foodtype = document.getElementsByName("ListFoodTypeHeader").item(0);
            if (foodtype.value != "0" && district.value != "0") {
                window.location.href = "../Home/SearchRestaurants?idcity=" + city.value + "&iddistrict=" + district.value + "&idfoodtype=" + foodtype.value;
            }
        }
        function onSelectedIndexChanged_FoodTypeHeader() {
            var city = document.getElementsByName("ListCityHeader").item(0);
            var foodtype = document.getElementsByName("ListFoodTypeHeader").item(0);
            // if district is have selected value
            var district = document.getElementsByName("ListDistrictHeader").item(0);
            if (district.value != "0" && foodtype.value != "0") {
                window.location.href = "../Home/SearchRestaurants?idcity=" + city.value + "&iddistrict=" + district.value + "&idfoodtype=" + foodtype.value;
            }
        }
    </script>
    <div id="PartialDiv">
		<% Html.RenderPartial("Templates/TH_Search", Model); %>
	</div>
    <div id="content">
        <div id="container">
            <div style="margin-top:10px;">&nbsp;</div>
            <div id="div_rest" style="width:800px;">
                <div id="restarea" style="width: 800px; float: left;">
                    <h1 style="font-size: 18px; margin-bottom: 10px;">Restaurants delivering to your district</h1>
                    <div style="text-align: right; margin-right: 20px; margin-bottom: 30px;">
                    </div>
                    <% foreach (var item in Model.RestaurantModel.GetModel.LstObjModel)
                       { %>
                        <div style="float: left; margin-right: 20px; margin-bottom: 20px; padding-left: 15px;" >
                            <div id="restlisting" >
                                <a href="<%= Url.Action("Order", "Home", new { idrestaurant = item.ID }) %>" >
                                    <img
                                            border="0"
                                            height="100"
                                            src="<%= Url.Action("ShowRestaurantImage", "Image", new { idrestaurant = item.ID })%>"
                                            width="230" />
                                </a>
                            </div>
                            <div class="tooltiprest" >
                                <b ><%= item.Name.Trim()%></b>
                                <br ><%= item.Address.Trim()%>
                                <% 
                                    var district = Model.AllDistrictModel.GetModel.LstObjModel.FirstOrDefault(n => n.ID == item.IDDistrict);
                                    var city = Model.AllCityModel.GetModel.LstObjModel.FirstOrDefault(n => n.ID == district.ID); 
                                %>
                                <% if (district != null)
                                   { %>
                                    <br ><%= district.Name.Trim() %>,    
                                <% } %>
                                <% if (city != null)
                                   { %>
                                    <%= city.Name.Trim() %>
                                <% } %>
                                <br >
                                <br >
                                <table >
                                    <tr >
                                        <td >Today:</td>
                                        <td ><%= item.TimeStart %> - <%= item.TimeEnd %></td>
                                    </tr>
                                </table>
                                <br >Estimated Service Time: <%= item.EstimatedServiceTime %>  minutes
                                <br >
                                <br >Cuisines: 
                                <% var foodtype = Model.FoodTypeModel.GetModel.LstObjModel.FirstOrDefault(n => n.ID == item.IDFoodType); %>
                                <% if (foodtype != null)
                                   {  %>
                                    <i ><%= foodtype.Name.Trim()%></i>
                                <% } %>
                                </br>
                                </br>
                                </br>
                                </br>
                                </br>
                                </br>
                                </br>
                            </div>
                            <div style="float: left; width: 170px;" >
                                <a href="<%= Url.Action("Order", "Home", new { idrestaurant = item.ID }) %>" ><%= item.Name.Trim()%></a>
                            </div>
                            <div style="float: left; width: 60px; text-align: right;" >Open</div>
                            <div style="clear: both;" >
                                <div id="tagline" >
                                    <%= foodtype.Name.Trim()%> Restaurant
                                </div>
                                <div id="distrestl" >
                                <% if (district != null)
                                   { %>
                                    <%= district.Name.Trim() %>
                                <% } %>
                                </div>
                                <div style="clear: both;" >
                                </div>
                            </div>
                        </div>
                    <% } %>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
